package com.cwt.common.constant;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * 系统常量
 */
@Configuration
public class SysConstant {

    // ============= 分隔符 ========================
    public static String colon = " : ";

    public static String rightABTwo = " >> ";

    public static String rightABThree = " >>> ";

    // ============= ehcache数据 ===================
    // 缓存失效时间
    public static final Integer ToLiveSeconds = 10 * 60;

    // 最后一次使用后的 失效时间
    public static final Integer ToIdleSeconds = 10 * 60;

    // ============= 缓存key ======================
    // sys缓存 key
    public static final String sysKey = "sysCacheKey";

    // 数据缓存
    public static final String dataKey = "dataCacheKey";

    // token缓存
    public static final String tokenKey = "tokens";

    // 验证码
    public static final String captcha = "captcha";

    // 电话验证码缓存
    public static final String sms = "sms";

    // ============ ehcache path ==================
    public static final String ehcachePath = "/cache/ehcache.xml";

    // ============== 缓存数据key ================
    public static final String dictNames = "dictNames";

    public static final String dictMaps = "dictMaps";

    public static final String users = "users";

    // UTF-8 字符集
    public static final String UTF8 = "UTF-8";

    // ============================= sys =================================
    //演示系统账户
    public static String DEMO_ACCOUNT = "test";
    //自动去除表前缀
    public static String AUTO_REOMVE_PRE = "true";
    //停止计划任务
    public static String STATUS_RUNNING_STOP = "stop";
    //开启计划任务
    public static String STATUS_RUNNING_START = "start";
    //通知公告阅读状态-未读
    public static String OA_NOTIFY_READ_NO = "0";
    //通知公告阅读状态-已读
    public static int OA_NOTIFY_READ_YES = 1;
    //部门根节点id
    public static Long DEPT_ROOT_ID = 0l;
    //缓存方式
    public static String CACHE_TYPE_REDIS ="redis";

    public static String LOG_ERROR = "error";

    // ================== shiro ====================
    /** 超级管理员ID */
    public static final int SUPER_ADMIN = 1;

    /** 数据权限过滤 */
    public static final String SQL_FILTER = "sql_filter";

    // ======================  file ====================
    /**
     * 云存储配置KEY
     */
    public final static String CLOUD_STORAGE_CONFIG_KEY = "CLOUD_STORAGE_CONFIG_KEY";

    // ========================  quartz  ==================
    /**
     * 任务调度参数key
     */
    public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY";

    /**
     * 百分号
     */
    public static final String PERCENT = "%";


    // ==================================  订单  =============================
    /**
     * 订单二维码存放地址
     */
    public static String ORDER_UPLOAD_DIR = "/orderQRCode/";

    @Value("${order.qrcode.image.path}")
    public void setOrderUploadDir(String orderUploadDir) {
        ORDER_UPLOAD_DIR = orderUploadDir;
    }

    /**
     * 系统公告图片地址
     */
    public static String SYS_NOTICE_DIR = "/noticeImg/";

    @Value("${system.notice.img.path}")
    public void setSysNoticeDir(String sysNoticeDir) {
        SYS_NOTICE_DIR = sysNoticeDir;
    }

    /**
     * 全部权限 ID
     */
    public static final int ALL_ROLE_ID = 1000000;
}
